<template>
  <div class="hello">
    <h1>{{msg}}</h1>
    <el-upload
      action="https://jsonPlaceholder.typicode.com/posts/"
      list-type="picture-card"
      :on-preview="hanlePictureCardpreview"
      :on-remove="handleRemove">
      <i class="el-icon-plus"></i>
      </el-upload>
    <el-dialog :visible.sync="dialogVisible">
      <img :src="dialogImageUrl" width="100%" alt="">
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'HellWorld',
  data () {
    return {
      msg: 'hello world',
      dialogImageUrl: '',
      dialogVisible: false
    }
  },
  methods: {
    handleRemove (file, fileList) {
      console.log(file, fileList)
    },
    handlePictureCardPreview (file) {
      this.dialogImageUrl = file.url
      this.dialogVisible = true
    }
  }
}
</script>

<style lang="less" scoped>
.hello {
  color: red;
}
</style>
